<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://www.springframework.org/tags/form"  prefix="fm"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
  .error{
      color:red;
      font-weight: 900;
  }
</style>
</head>
<body>
 <h3>添加员工</h3>
  <p>
    <a href="${pageContext.request.contextPath}/emp/list">回主页</a>
  </p>
		<!-- 必须使用Spring表单标签 -->
		<fm:form
		 	action="${pageContext.request.contextPath}/emp"
				 modelAttribute="emp" method="post">
			<!-- path 是原来表单的name属性 -->
			姓名：<fm:input path="ename" /><span><fm:errors path="ename" cssClass="error"></fm:errors></span>
			<br/>
			性别：<label>
			<fm:radiobutton path="esex" value="男" checked="true"/>男
			</label>
			<label>
			<fm:radiobutton path="esex" value="女" />女
			</label><br/>
			年龄：<fm:input path="eage"/> <span> <fm:errors path="eage" cssClass="error"></fm:errors> </span>
			<br/>
			薪资：<fm:input path="esalary"/><span><fm:errors path="esalary" cssClass="error"></fm:errors> </span>
			<br/>
			部门:
          	<fm:select path="dept.deptno" items="${depts}" 
            itemLabel="dname"  itemValue="deptno"
           ></fm:select> <br/>
       		经理:
          	<fm:select path="mgr.empno" items="${mgrs}"
            itemLabel="ename"  itemValue="empno"
          >	</fm:select> <br/>
         <input type="submit"  value="添加"/>
         <input type="reset"  value="重置"/>
		</fm:form>
</body>
</html>